package o;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Build.VERSION;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
import o.dky.d;

public final class ewb {
    private static List<Integer> ˊ = new ArrayList();

    public static void ˊ(int i) {
        ˊ.add(Integer.valueOf(i));
    }

    public static void ॱ(LinearLayout linearLayout, View view) {
        if (linearLayout != null && view != null) {
            linearLayout.removeAllViews();
            linearLayout.addView(view);
        }
    }

    public static void ˏ(Context context, Button button, String str) {
        if (!CollectCheck.isEmpty(ˊ) && !TextUtils.isEmpty(str)) {
            for (Integer intValue : ˊ) {
                if (str.equals(context.getString(intValue.intValue()))) {
                    button.setTextColor(context.getResources().getColor(d.ˎˎ));
                    return;
                }
            }
        }
    }

    public static void ˊ(Dialog dialog) {
        if (dialog == null || !(dialog instanceof AlertDialog)) {
            dialog = null;
        } else {
            dialog = (AlertDialog) dialog;
        }
        if (dialog != null) {
            Button button = dialog.getButton(-1);
            if (button != null) {
                button.setAllCaps(true);
            }
            button = dialog.getButton(-2);
            if (button != null) {
                button.setAllCaps(true);
            }
            button = dialog.getButton(-3);
            if (button != null) {
                button.setAllCaps(true);
            }
        }
    }

    public static int ˎ(@NonNull Activity activity) {
        int ˋ = epv.ˋ((Context) activity, 16);
        try {
            if (VERSION.SDK_INT >= 22) {
                TypedValue typedValue = new TypedValue();
                DisplayMetrics displayMetrics = new DisplayMetrics();
                activity.getTheme().resolveAttribute(16843987, typedValue, true);
                Display defaultDisplay = ((WindowManager) activity.getSystemService("window")).getDefaultDisplay();
                if (defaultDisplay != null) {
                    defaultDisplay.getMetrics(displayMetrics);
                    return TypedValue.complexToDimensionPixelSize(typedValue.data, displayMetrics);
                }
            }
        } catch (Exception e) {
            Logger.e("DialogUtil", e.toString());
        }
        return ˋ;
    }
}
